//
//  DeliveryTrackHeaderCell.m
//  ProjectforHDX
//
//  Created by motom on 16/8/11.
//  Copyright © 2016年 H.DX. All rights reserved.
//

#import "DeliveryTrackHeaderCell.h"

@interface DeliveryTrackHeaderCell()
@property (nonatomic, strong) UIImageView *stateImg;

@property (nonatomic, strong) DeliverModel *delModel;


@property (nonatomic, strong) RZCustomLable *laberSta;

@property (nonatomic, strong) RZCustomLable *laberCom;

@property (nonatomic, strong) RZCustomLable *laberNo;

@end

@implementation DeliveryTrackHeaderCell

- (void)awakeFromNib {
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupView];
    }
    return self;
}
#define CELL_HEIGHT 75

-(void)setupView
{
    RZCustomLable *laberSta = [[RZCustomLable alloc]init];
    self.laberSta = laberSta;
    [self addSubview:self.laberSta];
    
    RZCustomLable *laberCom = [[RZCustomLable alloc]init];
    self.laberCom = laberCom;
    [self addSubview:self.laberCom];
    
    RZCustomLable *labarNo = [[RZCustomLable alloc]init];
    self.laberNo = labarNo;
    [self addSubview:self.laberNo];
    
   
    
    UIView *distance = [[UIView alloc]init];
    distance.backgroundColor = [UtilCheck hexStringToColor:@"f6f7fb" alpha:1];
    [distance setFrame:CGRectMake(0, CELL_HEIGHT, SCREEN_WIDTH,  10)];
    [self addSubview:distance];

    [self addSoldLine:1.0 soldcolor:[UtilCheck hexStringToColor:@"f6f7fb" alpha:1] pointA:CGPointMake(0, CELL_HEIGHT) pointB:CGPointMake(SCREEN_WIDTH, CELL_HEIGHT)];
}

-(void)setDeliverModel:(DeliverModel *)model
{
    UIImageView *State = [[UIImageView alloc]initWithImage:BDFILEIMAGENAEM(@"Order/img_LogisticsState")];
    State.top = 15;
    State.left = 10;
    [self addSubview:State];
    self.stateImg = State;
    
    self.delModel = model;
    self.laberSta.text = [THMangerTool language:@"customer.logState"];
    NSMutableAttributedString *title = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@ ",self.laberSta.text]];
    NSLog(@"%@",title);
    NSAttributedString *attStr = [[NSAttributedString alloc]initWithString:self.delModel.status attributes:@{NSForegroundColorAttributeName:[UtilCheck hexStringToColor:@"23ae5d" alpha:1]}];
    [title appendAttributedString:attStr];
    self.laberSta.attributedText = title;
    self.laberSta.font = CustomFont(14);
    self.laberSta.left = self.stateImg.right +10;
    self.laberSta.top = 15;
    self.laberSta.width = self.width - State.right;
    [self.laberSta sizeToFit];
  
    
    
    self.laberCom.text = [THMangerTool language:@"customer.logCompany"];
    NSMutableAttributedString *title1 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@ : ",self.laberCom.text]];
    NSAttributedString *attStr1 = [[NSAttributedString alloc]initWithString:self.delModel.com attributes:@{NSForegroundColorAttributeName:[UIColor grayColor]}];
    [title1 appendAttributedString:attStr1];
    self.laberCom.attributedText = title1;
    self.laberCom.font = CustomFont(12);
    [self.laberCom setTextColor:[UtilCheck hexStringToColor:@"868686" alpha:1.0]];
    self.laberCom.left = self.laberSta.left;
    self.laberCom.top = self.laberSta.bottom+4;
    [self.laberCom sizeToFit];
  
    
    
    self.laberNo.text = [THMangerTool language:@"customer.delCode"];
    NSMutableAttributedString *title2 = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@ : ",self.laberNo.text]];
    NSAttributedString *attStr2 = [[NSAttributedString alloc]initWithString:self.delModel.code attributes:@{NSForegroundColorAttributeName:[UIColor grayColor]}];
    [title2 appendAttributedString:attStr2];
    self.laberNo.attributedText = title2;
    [self.laberNo setTextColor:[UtilCheck hexStringToColor:@"868686" alpha:1.0]];
    self.laberNo.left = self.laberSta.left;
    self.laberNo.top = self.laberCom.bottom;
    [self.laberNo sizeToFit];
    
     [self addSoldLine:1.0 soldcolor:[UtilCheck hexStringToColor:@"f0f0f0" alpha:1.0] pointA:CGPointMake(0, self.laberNo.bottom+10) pointB:CGPointMake(SCREEN_WIDTH, self.laberNo.bottom +10)];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
